﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CadastroApontamentos.aspx.cs" Inherits="WebApp_Scrum.Protegido.CadastroApontamentos" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="gvApontamentos" runat="server" AutoGenerateColumns="False" 
            CellPadding="4" DataKeyNames="CodigoApontamento" DataSourceID="odsApontamentos" 
            ForeColor="#333333" GridLines="None">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:CommandField ShowSelectButton="True" />
                <asp:BoundField DataField="CodigoApontamento" HeaderText="CodigoApontamento" 
                    SortExpression="CodigoApontamento" />
                <asp:BoundField DataField="CodigoTarefa" HeaderText="CodigoTarefa" 
                    SortExpression="CodigoTarefa" />
                <asp:BoundField DataField="DataAtividade" HeaderText="DataAtividade" 
                    SortExpression="DataAtividade" />
                <asp:BoundField DataField="HorasRealizadas" HeaderText="HorasRealizadas" 
                    SortExpression="HorasRealizadas" />
            </Columns>
            <EditRowStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F5F7FB" />
            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
            <SortedDescendingCellStyle BackColor="#E9EBEF" />
            <SortedDescendingHeaderStyle BackColor="#4870BE" />
        </asp:GridView>
        
        <asp:ObjectDataSource ID="odsApontamentos" runat="server" 
            DataObjectTypeName="Models.Apontamentos" DeleteMethod="Excluir" 
            InsertMethod="Incluir" OldValuesParameterFormatString="original_{0}" 
            SelectMethod="Listar" TypeName="BLL.ApontamentosBLL" UpdateMethod="Alterar">
            <DeleteParameters>
                <asp:Parameter Name="CodigoApontamento" Type="Int32" />
            </DeleteParameters>
        </asp:ObjectDataSource>
        <br />
        
        <asp:Button ID="novoApontamento" runat="server" Text="Novo apontamento" 
            onclick="novoApontamento_Click" />
        
        <br />
        
        <br />
        
        <asp:FormView ID="frvApontamentos" runat="server" CellPadding="4" 
            DataSourceID="odsApontamentosDetails" ForeColor="#333333" 
            onitemdeleted="frvApontamentos_ItemDeleted" 
            oniteminserted="frvApontamentos_ItemInserted" 
            onitemupdated="frvApontamento_ItemUpdated">
            <EditItemTemplate>
                <asp:TextBox ID="CodigoApontamentoTextBox" runat="server" 
                    Text='<%# Bind("CodigoApontamento") %>' visible="false" />                
                CodigoTarefa:
                <asp:DropDownList ID="dpTarefas" runat="server" DataSourceID="odsTarefas" 
                    DataTextField="NomeTarefa" DataValueField="CodigoTarefa" 
                    SelectedValue='<%# Bind("CodigoTarefa") %>'>
                </asp:DropDownList>
                <asp:ObjectDataSource ID="odsTarefas" runat="server" 
                    OldValuesParameterFormatString="original_{0}" SelectMethod="ListarGeral" 
                    TypeName="BLL.TarefasBLL"></asp:ObjectDataSource>
                <br />
                DataAtividade:
                <asp:TextBox ID="DataAtividadeTextBox" runat="server" 
                    Text='<%# Bind("DataAtividade") %>' />
                <br />
                HorasRealizadas:
                <asp:TextBox ID="HorasRealizadasTextBox" runat="server" 
                    Text='<%# Bind("HorasRealizadas") %>' />
                <br />
                <asp:Button ID="UpdateButton" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="Salvar" />
                &nbsp;<asp:Button ID="UpdateCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancelar" />
            </EditItemTemplate>
            <EditRowStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <InsertItemTemplate>
                CodigoTarefa:
                <asp:DropDownList ID="dpTarefas" runat="server" DataSourceID="odsTarefas" 
                    DataTextField="NomeTarefa" DataValueField="CodigoTarefa" 
                    SelectedValue='<%# Bind("CodigoTarefa") %>'>
                </asp:DropDownList>
                <asp:ObjectDataSource ID="odsTarefas" runat="server" 
                    OldValuesParameterFormatString="original_{0}" SelectMethod="ListarGeral" 
                    TypeName="BLL.TarefasBLL"></asp:ObjectDataSource>
                <br />
                DataAtividade:
                <asp:TextBox ID="DataAtividadeTextBox" runat="server" 
                    Text='<%# Bind("DataAtividade") %>' />
                <br />
                HorasRealizadas:
                <asp:TextBox ID="HorasRealizadasTextBox" runat="server" 
                    Text='<%# Bind("HorasRealizadas") %>' />
                <br />

                <asp:Button ID="InsertButton" runat="server" CausesValidation="True" 
                    CommandName="Insert" Text="Inserir" />
                &nbsp;<asp:Button ID="InsertCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancelar" />
            </InsertItemTemplate>
            <ItemTemplate>
                CodigoTarefa:
                <asp:DropDownList ID="dpTarefas" runat="server" DataSourceID="odsTarefas" 
                    DataTextField="NomeTarefa" DataValueField="CodigoTarefa" 
                    SelectedValue='<%# Bind("CodigoTarefa") %>' Enabled="false">
                </asp:DropDownList>
                <asp:ObjectDataSource ID="odsTarefas" runat="server" 
                    OldValuesParameterFormatString="original_{0}" SelectMethod="ListarGeral" 
                    TypeName="BLL.TarefasBLL"></asp:ObjectDataSource>
                <br />
                DataAtividade:
                <asp:Label ID="DataAtividadeLabel" runat="server" 
                    Text='<%# Bind("DataAtividade") %>' />
                <br />
                HorasRealizadas:
                <asp:Label ID="HorasRealizadasLabel" runat="server" 
                    Text='<%# Bind("HorasRealizadas") %>' />
                <br />
                <asp:Button ID="EditButton" runat="server" CausesValidation="False" 
                    CommandName="Edit" Text="Editar" />
                &nbsp;<asp:Button ID="DeleteButton" runat="server" CausesValidation="False" 
                    CommandName="Delete" Text="Excluir" />
            </ItemTemplate>
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
        </asp:FormView>


        <asp:ObjectDataSource ID="odsApontamentosDetails" runat="server" 
            DataObjectTypeName="Models.Apontamentos" DeleteMethod="Excluir" 
            InsertMethod="Incluir" OldValuesParameterFormatString="original_{0}" 
            SelectMethod="Ler" TypeName="BLL.ApontamentosBLL" UpdateMethod="Alterar">
            <DeleteParameters>
                <asp:Parameter Name="CodigoApontamento" Type="Int32" />
            </DeleteParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="gvApontamentos" Name="CodigoApontamento" 
                    PropertyName="SelectedValue" Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>


    </div>
    </form>
</body>
</html>
